# Created by: Jeremy Messenger <mezz@FreeBSD.org>
# $FreeBSD$

PORTNAME=	lightdm
PORTVERSION=	1.10.4
CATEGORIES=	x11
MASTER_SITES=	https://launchpadlibrarian.net/190231586/ \
	https://launchpad.net/${PORTNAME}/${PORTVERSION:R}/${PORTVERSION}/+download/

MAINTAINER=	olivierd@FreeBSD.org
COMMENT=	Light display manager

LICENSE=	GPLv3 LGPL3
LICENSE_COMB=	multi
LICENSE_DISTFILES=	${WRKSRC}/COPYING.GPL3 \
	${WRKSRC}/COPYING.LGPL3

BUILD_DEPENDS=	${LOCALBASE}/libdata/pkgconfig/iso-codes.pc:${PORTSDIR}/misc/iso-codes \
	itstool:${PORTSDIR}/textproc/itstool
LIB_DEPENDS=	libxklavier.so:${PORTSDIR}/x11/libxklavier \
	libgcrypt.so:${PORTSDIR}/security/libgcrypt \
	libaccountsservice.so:${PORTSDIR}/sysutils/accountsservice

USES=	pkgconfig gmake libtool gettext pathfix tar:xz
GNU_CONFIGURE=	yes
USE_GNOME=	glib20 introspection:build intlhack intltool libxml2
USE_XORG=	x11 xcb xdmcp ice

USE_RC_SUBR=	lightdm
SUB_FILES=	pkg-message

USERS?=	lightdm
GROUPS?=	lightdm

CONFIGURE_ARGS=--localstatedir=/var \
	--enable-introspection=yes \
	--disable-liblightdm-qt \
	--disable-liblightdm-qt5 \
	--disable-tests \
	--disable-gtk-doc \
	--without-html-dir \
	--with-greeter-user=${USERS}

PLIST_SUB+=	USER=${USERS} \
	GROUP=${GROUPS}

post-patch:
	${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
		${WRKSRC}/data/lightdm.conf \
		${WRKSRC}/common/user-list.c
	${CP} ${WRKSRC}/data/lightdm.conf \
		${WRKSRC}/data/lightdm.conf.sample

post-install:
	${MKDIR} ${STAGEDIR}/var/cache/lightdm
	${MKDIR} ${STAGEDIR}/var/lib/lightdm-data
	${MKDIR} ${STAGEDIR}/var/log/lightdm
	${MKDIR} ${STAGEDIR}/var/run/lightdm

.include <bsd.port.mk>
